home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / esc.jar / com / extensibility / xml / XSDLWriter$AttrProxy.class (.txt) < prev    next >
Encoding:
Java Class File  |  2000-06-30  |  3.2 KB  |  84 lines

  1. package com.extensibility.xml;
  2.  
  3. import com.extensibility.xml.dt.Facet;
  4. import java.util.Enumeration;
  5.  
  6. public class XSDLWriter$AttrProxy extends XSDLWriter.DeclProxy {
  7.    // $FF: synthetic field
  8.    final XSDLWriter this$0;
  9.    AttributeDeclaration decl;
  10.  
  11.    XSDLWriter$AttrProxy(XSDLWriter var1) {
  12.       super(var1);
  13.       this.this$0 = var1;
  14.    }
  15.  
  16.    XSDLWriter$AttrProxy(XSDLWriter var1, AttributeDeclaration var2) {
  17.       super(var1);
  18.       this.this$0 = var1;
  19.       this.setDecl(var2);
  20.    }
  21.  
  22.    boolean isGlobal() {
  23.       return this.decl.isGlobal();
  24.    }
  25.  
  26.    void setDecl(AttributeDeclaration var1) {
  27.       this.decl = var1;
  28.       super.setDecl(var1);
  29.    }
  30.  
  31.    public void write(SXE var1, boolean var2) {
  32.       if (this.this$0.isPreviewing()) {
  33.          this.writeType(var1, var2);
  34.       }
  35.  
  36.    }
  37.  
  38.    void writeValues(SXE var1) {
  39.       if (this.decl.isEnumeration() || this.decl.isNotation() || this.decl.getDataType().hasFacet(Facet.FACET_ENUM_NAME)) {
  40.          Enumeration var2 = this.decl.getChoices(this.this$0.schema, true);
  41.  
  42.          while(var2.hasMoreElements()) {
  43.             var1.writeElem("enumeration", -1);
  44.             String var3 = (String)var2.nextElement();
  45.             var1.writeAttr("value", var3);
  46.             var1.flush("enumeration");
  47.          }
  48.  
  49.       }
  50.    }
  51.  
  52.    void writeType(SXE var1, boolean var2) {
  53.       var1.writeElem("attribute", -1);
  54.       var1.writeAttr("name", this.decl.getName());
  55.       if (this.decl.getRequired()) {
  56.          if (this.decl.getDefault() == null) {
  57.             var1.writeAttr("use", "required");
  58.          } else {
  59.             var1.writeAttr("use", "fixed");
  60.             var1.writeAttr("value", this.this$0.schema.expandPERefs(this.decl.getDefault(), this.decl));
  61.          }
  62.       } else if (this.decl.getDefault() != null) {
  63.          var1.writeAttr("use", "default");
  64.          var1.writeAttr("value", this.this$0.schema.expandPERefs(this.decl.getDefault(), this.decl));
  65.       }
  66.  
  67.       String var3 = this.decl.getDataType().getOptions();
  68.       if (this.decl.getDataType().getOptions().length() == 0) {
  69.          XSDLWriter.access$2000171(this.this$0, var1, this.decl, this.decl.getDataType());
  70.          if (var2) {
  71.             ((XSDLWriter.DeclProxy)this).writeComments(var1);
  72.          }
  73.       } else {
  74.          if (var2) {
  75.             ((XSDLWriter.DeclProxy)this).writeComments(var1);
  76.          }
  77.  
  78.          XSDLWriter.access$2000371(this.this$0, var1, (String)null, this.decl, this.decl.getDataType(), false);
  79.       }
  80.  
  81.       var1.flush("attribute");
  82.    }
  83. }
  84.